package lzk.myshop.dao;

import lzk.myshop.pojo.CartDetail;
import lzk.myshop.pojo.OrderDetail;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CartDetailMapper {

    @Insert("insert into `cartdetail` (`cartid`,`goodsid`,`number`,`goodsname`,`price`) values (#{cartid},#{goodsid},#{number},#{goodsname},#{price})")
    int addCart(CartDetail cartDetail);

    @Select("select * from `cartdetail` where `cartid` = #{id}" )
    List<CartDetail> getAllCart(int id);

    @Delete("delete from `cartdetail` where `id`=#{id}")
    int deleteCart(int id);
}
